package fzu.functiongather.ShareAddress;

import android.app.Activity;
import android.content.ClipboardManager;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import fzu.functiongather.R;

/**
 * Created by Administrator on 2016/8/20.
 */
public class ShareAddressActivity extends Activity implements View.OnClickListener {
    private String address="www.baidu.com";
    private Button btn_shareAddress;
    private TextView tv_shareAddress;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.shareaddress_main);
        initView();
        initWidget();
    }
    private void initView(){
        btn_shareAddress=(Button)findViewById(R.id.btn_shareAddress);
        tv_shareAddress=(TextView)findViewById(R.id.tv_shareAddress);
        tv_shareAddress.setText(address);
    }
    private void initWidget(){
        btn_shareAddress.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_shareAddress:
                ClipboardManager cbm=(ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
                cbm.setText(address);
                break;
        }
    }
}
